package com.itheima.stock.mapper;

import com.itheima.stock.common.domain.StockScreenDayDomain;
import com.itheima.stock.common.domain.StockScreenMinDomain;
import com.itheima.stock.common.domain.StockUpDownDomain;
import com.itheima.stock.pojo.StockRtInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* @author 树
* @description 针对表【stock_rt_info(个股详情信息表)】的数据库操作Mapper
* @createDate 2022-01-08 20:06:53
* @Entity com.itheima.stock.pojo.StockRtInfo
*/
@Mapper
public interface StockRtInfoMapper {

    List<StockUpDownDomain> getUpDownAllPage();

    int deleteByPrimaryKey(Long id);

    int insert(StockRtInfo record);

    int insertSelective(StockRtInfo record);

    StockRtInfo selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(StockRtInfo record);

    int updateByPrimaryKey(StockRtInfo record);

    /**
     * 沪深两市个股涨幅分时行情数据
     * @return
     */
    List<StockUpDownDomain> getUpDownAllLimit();

    List<Map> getUpDownCount(@Param("lastAvDate") String lastAvDate,@Param("i") Integer i);

    /**
     * 统计两市成交量在每分钟的之和的统计
     * @param lastAvDate
     * @param i
     * @return
     */
    List<Map> getStockTravolCompare(@Param("avDate") String lastAvDate, @Param("i") Integer i);

    /**
     * 查询当前时间下股票的涨跌幅度区间统计功能
     * @param lastAvDate
     * @return
     */
    List<Map> getStockUpDownScope(@Param("lastAvDate") String lastAvDate);

    /**
     * 查询单个个股的分时行情数据，查询时间周期是T日开盘到当前时间
     * @param lastAvDate
     * @param code
     * @return
     */
    List<StockScreenMinDomain> getStockScreenMinuteSharing(@Param("lastAvDate") String lastAvDate, @Param("code") String code);

    /**
     * 单个个股日K 数据查询 ，可以根据时间区间查询数日的K线数据
     * @param forwardDate
     * @param code
     * @return
     */
    List<StockScreenDayDomain> getDayKLinData(@Param("forwardDate") Date forwardDate, @Param("code") String code);

    /**
     * 批量插入A股信息
     * @param list
     * @return
     */
    int  insertBatch(@Param("list") List<StockRtInfo> list);
}
